package mk.timska_rabota_android;

import java.util.ArrayList;

import mk.timska_rabota_android.contacts.Contact;
import mk.timska_rabota_android.contacts.ContactsModule;
import mk.timska_rabota_android.messages.Message;
import mk.timska_rabota_android.messages.MessagesModule;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ListNewMessages extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list_new_messages);
		
		ArrayList<Message> Messages = MessagesModule.getMyMessages(new Contact());
		ArrayList<String> strings = MessagesModule.messagesToString(Messages);
		
		ListView lista = (ListView)findViewById(R.id.listMessages);
		ArrayAdapter adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, strings);
		lista.setAdapter(adapter);
		adapter.notifyDataSetChanged();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.list_new_messages, menu);
		return true;
	}

}
